#include<stdio.h>

int sum(int a,int b,int r)
{
   a=(a+r-1)/r*r;
   b=b/r*r;
    int n=(b-a)/r+1;

    return n*(a+b)/2 ;
}

int main()
{
    printf("%d\n",sum(1,1000,3*5));
    return 0;
}
